﻿package com.app.view.component.room.seat 
{
	import flash.display.MovieClip;
	import flash.events.Event;
	
	import com.peachcastle.core.Display;
	import com.peachcastle.core.TimerCircle;
	
	/**
	 * ...
	 * @author kevin
	 */
	public class Clock extends Display
	{
		private var _timeline:TimerCircle = null; 
		
		public function Clock(ui:MovieClip = null) 
		{
			super(ui);
		}
		
		override protected function initialization():void 
		{
			super.initialization();
			
			_timeline = new TimerCircle(assest);
			assest.visible = false;
		}
		
		override protected function configEventListeners():void 
		{
			super.configEventListeners();
			
			_timeline.addEventListener(Event.CHANGE, onChange);
		}
		
		private function onChange(event:Event):void
		{
			dispatchEvent(event);
		}
		
		
		public function start(value:int, max:int = 30):void
		{
			assest.visible = true;
			_timeline.Start(value, max);
		}
		
		public function stop():void
		{
			_timeline.Stop();
			assest.visible = false;
			
		}
		
		public function get time():int { return _timeline.time; }
		
		
	}

}